/**
 *history回退函数集合
 *
 * @class BackPageInfo
 */
import { isWeb } from '@facejs/macro';
import { sessionStorage } from '@packages/lib-storage';

if (isWeb) WPT.historyInfo = {};

export default class BackPageInfo {
    static backStep = sessionStorage.getItem('backStep');
    static backUrl = sessionStorage.getItem('backUrl');
    static backBeforeUrl = sessionStorage.getItem('backBeforeUrl');
    static isFirstBack = Number(sessionStorage.getItem('First_Back')) || 2;
    static historyRouter = sessionStorage.getItem('historyRouter');
    static historyUrl = sessionStorage.getItem('historyUrl');

    static setStep = (num) => {
        sessionStorage.setItem('backStep', num);
        WPT.historyInfo.backStep = num;
    };

    static setBeforeUrl = (url) => {
        sessionStorage.setItem('backBeforeUrl', url);
        WPT.historyInfo.backBeforeUrl = url;
    };

    static setBackUrl = (url) => {
        sessionStorage.setItem('backUrl', url);
        WPT.historyInfo.backUrl = url;
    };

    static setFirstBack = (num) => {
        sessionStorage.setItem('First_Back', num);
        WPT.historyInfo.isFirstBack = num;
    };
}
